package com.xkcyy.study.spring.d02_registry;

import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * d02_registry
 *
 * @author yuand
 * @date 2021/6/8
 **/
public class D2SelfRegistry {

    static class UserService {
        public void test(){
            System.out.println("UserService.test");
        }
    }

    @Test
    void importBean(){
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.registerBean(UserService.class);
        context.refresh();
        context.getBean(UserService.class).test();
    }

}
